package com.cq.smartelebicycle.fragment;

import com.cq.smartelebicycle.MainFragment;
import com.cq.smartelebicycle.R;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;

public class ZhuliFragment extends Fragment implements OnClickListener{
	
	public static final String TAG_ID = "ZhuliFragment";
	
	private MainFragment activity;
	private static final int ZHULI_OFF = 0;
	private static final int ZHULI_ON =1;
	private ImageView  qiangImg;
	private ImageView  zhongImg;
	private ImageView  ruoImg;
	private ImageView  wuImg;
	

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
		activity = (MainFragment)getActivity();
		
		
		  qiangImg =(ImageView)activity.findViewById(R.id.zhuli_qiang_icon);
		qiangImg.setOnClickListener(this);
		  zhongImg =(ImageView)activity.findViewById(R.id.zhuli_zhong_icon);
		  zhongImg.setOnClickListener(this);
		  ruoImg =(ImageView)activity.findViewById(R.id.zhuli_ruo_icon);
		  ruoImg.setOnClickListener(this);
		  wuImg =(ImageView)activity.findViewById(R.id.zhuli_wu_icon);
		  wuImg.setOnClickListener(this);
		
		
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view = inflater.inflate(R.layout.zhuli_fragment, container,false); 
		return view;
	}

	@Override
	public void onClick(View view) {
		// TODO Auto-generated method stub
		int id = view.getId();
		switch (id) {
		case R.id.zhuli_qiang_icon:
			qiangImg.setImageResource(R.drawable.zhuli_on);
			zhongImg.setImageResource(R.drawable.zhuli_off);
			ruoImg.setImageResource(R.drawable.zhuli_off);
			wuImg.setImageResource(R.drawable.zhuli_off);
			break;
		case R.id.zhuli_zhong_icon:
			qiangImg.setImageResource(R.drawable.zhuli_off);
			zhongImg.setImageResource(R.drawable.zhuli_on);
			ruoImg.setImageResource(R.drawable.zhuli_off);
			wuImg.setImageResource(R.drawable.zhuli_off);
			break;
		case R.id.zhuli_ruo_icon:
			qiangImg.setImageResource(R.drawable.zhuli_off);
			zhongImg.setImageResource(R.drawable.zhuli_off);
			ruoImg.setImageResource(R.drawable.zhuli_on);
			wuImg.setImageResource(R.drawable.zhuli_off);
			break;
		case R.id.zhuli_wu_icon:
			qiangImg.setImageResource(R.drawable.zhuli_off);
			zhongImg.setImageResource(R.drawable.zhuli_off);
			ruoImg.setImageResource(R.drawable.zhuli_off);
			wuImg.setImageResource(R.drawable.zhuli_on);
			break;

		default:
			break;
		}
		
	}

	
	
	
}
